package com.chaihu.front.components.validate;

import com.chaihu.core.context.IPageData;
import com.chaihu.front.service.validate.ValidateCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

/**
 * 验证码组件
 */
@Component("validate-code")
public class ValidateCodeComponent {

    @Autowired
    private ValidateCodeService validateCodeService;

    /**
     * 生成 验证码
     *
     * @param pd
     * @return
     */
    public ResponseEntity<String> generateValidateCode(IPageData pd) {
        return validateCodeService.generateValidateCode(pd);
    }

    /**
     * 校验验证码
     *
     * @param pd
     * @return
     */
    public ResponseEntity<String> validate(IPageData pd) {
        return validateCodeService.validate(pd);
    }
}
